# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=meanalyzer
_pkgname=MEAnalyzer
pkgver=1.273.0
_rev=275
pkgrel=6
pkgdesc='Intel Engine Firmware Analysis Tool.'
arch=('x86_64')
groups=('blackarch' 'blackarch-firmware')
url='https://github.com/platomav/MEAnalyzer'
license=('GPL3')
depends=('python' 'python-colorama' 'python-crccheck' 'python-ptable-boxchar'
         'python-prettytable')
source=("https://github.com/platomav/$_pkgname/archive/v$pkgver-r$_rev.tar.gz")
sha512sums=('a92d68bab524c0ab1383168e8e76b04b2cf000bf9364c0ae91cb6e8472a2a1aa987d912d8a3e4d95b02a06ddf2b0c095afcf337925e6fc5268c55bf5e03b772f')
noextract=("ME_Analyzer_v${pkgver}_r$_rev.rar")

package() {
  cd "$_pkgname-$pkgver-r$_rev"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" Changelog.txt README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf Changelog.txt README.md LICENSE

  cp -a --no-preserve=owner * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python MEA.py "\$@"
EOF
   chmod +x "$pkgdir/usr/bin/$pkgname"
}

